// Ofri Keidar 302933981 group 05

/**
 * The class represents a penthouse. 
 * The class inherits from class Apartment. The class is serializable so a building could be saved and restored from a file easily 
 */

package model.apartment;

public class Penthouse extends Apartment {
	
	private static final long serialVersionUID = 7278320741185870656L; // set serial number

	// methods
	
	/**
	 * Constructor- initializes a new penthouse using given values
	 * @param floor- penthouse's floor
	 * @param roomNum- penthouse's room number
	 * @param size- penthouse's size
	 * @param balcony- penthouse's balcony size
	 * @param resName- penthouse's resident name
	 */
	public Penthouse(int floor, double roomNum, double size, double balcony, String resName) {
		// initialize attributes according to given values
		super(floor, roomNum, size, balcony ,resName); // use base class's constructor
	}
		
	/**
	 * Constructor- initializes a new penthouse using given values. Used when no resident name is given
	 * @param floor- penthouse's floor
	 * @param roomNum- penthouse's room number
	 * @param size- penthouse's size
	 * @param balcony- penthouse's balcony size
	 */
	public Penthouse(int floor, double roomNum, double size, double balcony) {
		// initialize attributes according to given values
		super(floor, roomNum, size, balcony); // use base class's constructor
	}
	
	/**
	 * Returns balcony size, using base class's extra unit getter 
	 * @return- balcony size
	 */
	public double getBalconySize() { return getExtraUnit(); }
	
	/**
	 * Sets balcony as given value
	 * @param newSize- new size for balcony
	 */
	public void setBalconySize(double newSize) { setExtraUnit(newSize); }
	
	/**
	 * Calculates penthouse's total area as sum of penthouse's size and balcony 
	 */
	public double totalArea() {
		// sum size and balcony area and return result
		return getSize() + getExtraUnit(); 
	}
		
	/**
	 * Returns penthouse's printing format (as a String object) using base class's toString() 
	 */
	public String toString() {
		// use Apartment class's string format to create output
		return "Type: penthouse, " + super.toString();
	}
}
